﻿using System;
using System.Web.Mvc;
using Sharp.Infrastructure.WebApiClient;
using Sharp.Portal.Mvc;
using Sharp.ServiceContracts;
using Sharp.WebBooter.Areas.Platform.Models;
// ReSharper disable Mvc.ViewNotResolved

namespace Sharp.WebBooter.Areas.Platform.Controllers
{
    [Authorize]
    [AutomaticTemplate]
    public class UserLogController : SharpController
    {
        public ActionResult Index()
        {
            return View(new UserLogIndexViewModel());
        }

        
        public ActionResult GetPaged(DataTableParameter param)
        {
            using (var proxy = new WebApiClientServiceProxy<IUserService>())
            {
                var page = proxy.Channel.GetUserLogPaged(param.ToPagingFeature());

                return Content(page.ToReturnedData().ToJson());
            }
        }
        
        [Permission("删除", 0,  "002004001")]
        public ActionResult Delete(int[] ids)
        {
            using (var proxy = new WebApiClientServiceProxy<IUserService>())
            {
                var res = proxy.Channel.DeleteUserLogs(ids);
                return this.JsonNet(res);
            }
        }
    }
}
